﻿using Creator.Core.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DesktopCreator.Controls
{
    /// <summary>
    /// UCBaseObject.xaml 的交互逻辑
    /// </summary>
    public partial class UCBaseObject : UserControl
    {
        public UCBaseObject()
        {
            InitializeComponent();
        }

        public UCBaseObject(BaseObject baseObject) : this()
        {
           DataContext =  BaseObject = baseObject;
            Title = baseObject.Name.ToString();
            TitleFontSize = 9;
        }
        public long id = BitConverter.ToInt64(Guid.NewGuid().ToByteArray(),0);
        public BaseObject BaseObject { get; private set; }

        public string Title
        {
            get
            {
                return txtTitle.Text;
            }
            set
            {
                txtTitle.Text = value;
            }
        }
        public string Description
        {
            get
            {
                return txtDir.Text;
            }
            set
            {
                txtDir.Text = value;
            }
        } 
        public double TitleFontSize
        {
            get
            {
                return txtTitle.FontSize;
            }
            set
            {
                if (value <= 0) return;
                txtTitle.FontSize = value;
                txtDir.FontSize = value;
            }
        }
    }
}
